package cn.tedu._05mvcboot01.controller;

import cn.tedu._05mvcboot01.pojo.dto.UserLoginDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
    @RequestMapping("/v1/users/login")
    @ResponseBody
    public String login(){
        return "登录成功";
    }
    @RequestMapping("/v1/users/reg")
    @ResponseBody
    public String reg(){
        return "注册成功";
    }

    /*
    1
     */
    @RequestMapping("/v1/users/login1")
    @ResponseBody
    public String lohin1(HttpServletRequest request){
        String username=request.getParameter("username");
        String password=request.getParameter("password");
        return username+"-"+password;
    }
    /*
    2
     */
//    @RequestMapping("/v1/users/login2")
//    @ResponseBody
//    public String login2(UserLoginDTO userLoginDTO){
//        String username= userLoginDTO.getUsername();
//        String password= userLoginDTO.getPassword();
//        return username+"-"+password;
//    }
    /*
    3接受数据方式3
     */
    @RequestMapping("/v1/users/login3")
    @ResponseBody
    public String login3(String username,String password){
        return username+"++++++"+password;
    }










}
